<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
<script src="../resources/js/jquery-1.7.2.min.js"></script>
<script src="res/My97DatePicker/WdatePicker.js"></script>
<link rel="stylesheet" type="text/css" href="res/My97DatePicker/skin/WdatePicker.css">
<script type="text/javascript">
//var jsonserver="http://192.168.37.116:8089/mobile-html5-rest/";	
//var jsonserver="http://192.168.6.61:8580/mobile-html5-rest/";	
var jsonserver="http://bj.911860.com/mobile-html5-rest/";
$(document).ready(function(e) {
	$("#userphone").val("");
	$("#userphone").focus();
    $("#queryBtn").click(function(){
		//alert(1);
		var dataArray=$("#releasedate").val().split("-");
		$("#dateshow").text(dataArray[0]+"年"+dataArray[1]+"月"+dataArray[2]+"日");
		var u1=jsonserver+"newFlow/activeData/"+$("#releasedate").val()+"/"+$("#sel").val();
		$.getJSON(u1+".jsonp?callback=?",{},function(data){
			$("#pv").text(data.pvCount);
			$("#uv").text(data.uvCount);
			$("#applyCount").text(data.applyUserList.length);
			$("#applyUsers").children().remove();
			$.each(data.applyUserList,function(i,items){
				var l=$("<li>").text(items);
				l.appendTo($("#applyUsers"));
			});
		});
	});
	
	$("#insertBtn").click(function(){
		insertData();
	});
	$("#updateBtn").click(function(){
		updateDate();
	});
	
});
function insertData(){

		var u1=jsonserver+"newFlow/insert/"+$("#userphone").val();
		if($("#userphone").val()!=null && $("#userphone").val()!="" && $("#userphone").val()!=" "){
		$.getJSON(u1+".jsonp?callback=?",{},function(data){

			if(data==1){
				alert("记录成功!");
			}
		});
		}else{
			alert("号码不能为空!");
		}
}
function updateDate(){

		var u1=jsonserver+"newFlow/mdate/"+$("#releasedate1").val();
		if($("#releasedate1").val()!=null && $("#releasedate1").val()!="" && $("#releasedate1").val()!=" "){
		var inputBool=confirm("确定将数据日期更新为"+$("#releasedate1").val()+"吗?");
		if(inputBool){
			$.getJSON(u1+".jsonp?callback=?",{},function(data){
				if(data.status=='00000'){
					alert("更新成功!");
				}
			});
		}
		}else{
			alert("日期不能为空!");
		}
}
</script>
<style type='text/css'>
span{
font-weight:bold;
}
div li{
	color:green;
}
</style>
</head>

<body>
<div style="margin:0px auto; ">
 请选择查询日期:<input type="text" id="releasedate" class="Wdate" onClick="WdatePicker()" readonly/><select id="sel"><option value='1'>截止</option><option value='0'>单日</option></select>
    <button id="queryBtn">查询</button>
   </div>
  
 <div >PV:<span id="pv"></span></div>
 <div >UV:<span id="uv"></span></div>
 申请用户的列表(<span id="applyCount"></span>):
 <div>
	 <div id="applyUsers" style="float:left;margin-left:50px;">
		
	 </div>
	  <div id="insertUser" style="float:right;margin-right:50px;">
	  	<span style='color:green; font-weight:bold;'>未识别用户录入</span>:<br><br>
			请输入号码:<input type="number" id="userphone"/> <button id="insertBtn">记录</button>
            <br>
            
            <br><br>
            <span style='color:green; font-weight:bold;'>活动数据日期更新</span><br><br>
            <div id="updateDate" style="float:right;margin-right:50px;">
	  		 请输入日期:<input type="text" id="releasedate1" class="Wdate" onClick="WdatePicker()" readonly/>
			 <button id="updateBtn">确定</button>
	 	     </div>
	 </div>
     
</div>

     
</body>
</html>
